Component({
  data: {
    selected: 0,
    color: '#999',
    selectedColor: '#000',
    list: [
      {
        pagePath: '/pages/home/index',
        text: '首页',
      },
      {
        type: 'record',
        pagePath: '/pages/record/index',
        image: '/images/add.png',
      },
      {
        pagePath: '/pages/mine/index',
        text: '我的',
      },
    ],
  },
  attached() {},
  methods: {
    switchTab(e) {
      const { item, index } = e.currentTarget.dataset;
      const url = item.pagePath;
      wx.switchTab({ url });
      this.setData({ selected: index });
    },
  },
});
